//
//  FDSetUserInfoController.m
//  FamousDoctorOnline
//
//  Created by wszyxc on 16/7/9.
//  Copyright © 2016年 wszyxc. All rights reserved.
//

#import "FDSetUserInfoController.h"

@interface FDSetUserInfoController ()


@property (weak,nonatomic) UITextField * inputField;

@end

@implementation FDSetUserInfoController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"取消" style:UIBarButtonItemStylePlain target:self action:@selector(cancelClick)];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"保存" style:UIBarButtonItemStylePlain target:self action:@selector(saveClick)];
   
    [self setupUI];
    
    [self setupLayout];
    
    self.view.backgroundColor = [UIColor colorWithRed:240.0/255 green:240.0/255 blue:240.0/255 alpha:1];
    
}

- (void)saveClick{
    NSLog(@"保存信息");
    
    //保存用户信息
    
//    先拼接用户名
    
    NSString *userMax = [WZHUserDefaults WZHStringForKey:@"userIDMax"];
    
    NSString *saveStr = [NSString stringWithFormat:@"%@-%@",self.title,userMax];
    
    self.listMDict[self.listKey] = userMax;
    
    self.listArray[_index] = self.inputField.text;
    
 //   [WZHUserDefaults WZHSaveObject:self.inputField.text forKey:saveStr];
    
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)cancelClick{
    
    [self.navigationController popViewControllerAnimated:YES];
    
}



- (void)setupUI{
    
    
    UITextField *inputField = [[UITextField alloc]init];
    
    self.inputField = inputField;
    
    inputField.background = [UIImage imageNamed:@"shurukuang"];
    
    inputField.clearButtonMode = UITextFieldViewModeAlways;
    
    inputField.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 5, 40)];
    
    inputField.leftViewMode = UITextFieldViewModeAlways;
    
    [self.view addSubview:inputField];
    
    
}

- (void)setupLayout{
    
    [self.inputField mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.leading.trailing.offset(0);
        
        make.top.offset(80);
        
        make.height.offset(40);
        
        
    }];
    
    
}





@end
